﻿import FlatRedBall.Math.Geometry
import FlatRedBall

class BooBehaviour():
	static modules = {}
	static bgName = "bg"
	static bgNumber = 0
	static maxBgNumber = 4
	static beatName = "beat"
	static beatNumber = 0
	static maxBeatNumber = 10
	static towerNumber = 0
	static maxTowerNumbers = 10
	//Tower Index and Mass
	static towers = [5,1,2,10,3,4,6,1,7,2]
	static towersName = "tower"
	static towersImageExtension = ".jpg"
	static probabilityTower = 75
	static ballMass = 5

	static def loadModules(name as string, method as duck):
		if modules.ContainsKey(name) == false:
			modules.Add(name, method)		

	static def ChangeBg():
		song = bgName + "" + bgNumber
		bgNumber++
		if bgNumber == maxBgNumber:
			bgNumber = 0
		modules["Map"].PlaySong(song)
	
	static def CreateTower():
		towerNumber = modules["Map"].TowerList.Count
		//if modules["MathUtils"].GetRandomNumberMaxNumber(100) < probabilityTower and towerNumber < maxTowerNumbers:
		if towerNumber < maxTowerNumbers:
			towerIndex = modules["MathUtils"].GetRandomNumberMaxNumber(maxTowerNumbers)
			modules["Map"].AddTower(towersName+towerIndex+towersImageExtension, towers[towerIndex])
			towerNumber++
		if towerNumber == maxTowerNumbers:
			towerNumber = 0

	static def LoadMap(): //static lets us invoke this method without needing to instanize a class.
		//for i in range(5):
		//	CreateTower()
		if modules["Space"].Mass != ballMass:
			modules["Space"].Mass = ballMass
		for i in range(maxTowerNumbers):
			modules["Map"].AddSound(beatName+i)
		ChangeBg()